@extends('layouts/admin')
@section('title',"编辑分类")
@section('main')
    <h3>修改分类</h3>
    <form action="{{url('admin/category/doedit')}}" method="post" class="form-horizontal" enctype="multipart/form-data">
        <div class="form-group">
            <div class="col-md-2">
                <label class="control-label">父类</label>
            </div>
            <div class="col-md-5">
                <select name="pid" disabled class="form-control">
                    <option value="0">顶级分类</option>

                        @foreach($arr as $v)
                            @if($v['id'] == $ob -> pid)
                                <option selected="selected" value="{{$v['id']}}">{{$v['indentcname']}}</option>
                            @else
                                <option value="{{$v['id']}}">{{$v['indentcname']}}</option>
                            @endif
                        @endforeach

                </select>
            </div>
            <div class="col-md-5">
                <span class="help-block">请选择父类</span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-2">
                <label class="control-label">标题</label>
            </div>
            <div class="col-md-5">
                <input type="text" name="cname" value="{{$ob['cname']}}" class="form-control" required>
            </div>
            <div class="col-md-5">
                <span class="help-block">标题必须填写</span>
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-2">
                <label class="control-label">是否推荐</label>
            </div>
            <div class="col-md-5">
                <input type="radio" name="recommend" @if($ob->recommend == 0) checked  @endif value="0"> 不推荐
                <input type="radio" name="recommend" @if($ob->recommend == 1) checked  @endif value="1"> 推荐
            </div>
            <div class="col-md-5">
                <span class="help-block"></span>
            </div>
        </div>
        <input type="hidden" value="{{$ob->id}}" name="id">
        {{csrf_field()}}
        <div class="form-group">
            <div class="col-md-10 col-md-offset-2">
                <input type="submit" value="添加" class="btn btn-primary">
                <input type="reset" value="取消" class="btn btn-default">
            </div>
        </div>

    </form>
@endsection